package mmult

import chisel3._
import chisel3.iotesters.PeekPokeTester
import chisel3.util._

class MatrixMultiplication1Tester(dut: MatrixMultiplication1)
    extends PeekPokeTester(dut) {
  for (i <- 0 until 15)
    poke(dut.io.a(i), i)

  for (i <- 0 until 10)
    poke(dut.io.b(i), i)

  poke(dut.io.inValid, 1)

  step(1)

  while (peek(dut.io.outValid) == BigInt(0)) {
    step(1)
  }

  expect(dut.io.out(0), 60)
  expect(dut.io.out(1), 70)
  expect(dut.io.out(2), 160)
  expect(dut.io.out(3), 195)
  expect(dut.io.out(4), 260)
  expect(dut.io.out(5), 320)
}

object MatrixMultiplication1Tester extends App {
  chisel3.iotesters.Driver(() => new MatrixMultiplication1(3, 2, 5)) { dut =>
    new MatrixMultiplication1Tester(dut)
  }
}
